	<?php #Поиск

	
	$str = trim( $_POST['q'] );
	$list = '';
	
	if( $str )
	{
		$users	= isset( $GLOBALS['users'] ) ? $GLOBALS['users'] : array();
		$admin = in_array( $user->id, $users ) ? true : false;

		$params = array(
			'where'	=> '( `index_full_name` LIKE "%'.getGoodUrl( $str, '' ).'%" OR `product_code` LIKE "%'.$str.'%" )',
			'limit'	=> 10,
		);
		$products = getProductList( $params );
		foreach( $products['list'] as $pr ) {
			$red = ( ( !(int)$pr->price_retail || !strlen( $pr->volume ) ) && $admin ) ? 'class="red"' : '';
			$list .= '<li><a '.$red.' href="/'.$pr->url.'">'.$pr->prefix.' '.$pr->brand.' '.$pr->name.' <span> ('.$pr->product_code.')</span></a></li>';
		}
	}
	echo $list ? '<ul class="form-search__list">'.$list.'</ul>' : '';